package com.investment.util.Response;

/**
 * Created by veicth on 2017/6/10.
 */

public class Response<E> {

    public Response() {
        super();
    }

    private int code;
    private String msg;
    private E data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public Response(int code, String msg, E data) {
        super();
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <E> Response<E> success(E data) {
        return new Response<E>(200, "", data);
    }

    public static <E> Response<E> failed(String errMsg, E data) {
        return new Response<E>(400, errMsg, data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
